/**
 * @author sux
 * @time 2011-04-04
 * @desc 
 */

LeaveGridWin = Ext.extend(Ext.Window,{
	id: 'leaveGridWinId',
	constructor: function(){
		var empGridPanel = new LeaveGridPanel();
		EmpGridWin.superclass.constructor.call(this, {
			width: 550/2,
			height: 350,
			resizable: false, //不能改变窗体大小 
			title: '学生信息',
			collapsible: true,
			modal: true,
			items: [empGridPanel]
		})
	}
});
LeaveGridPanel = Ext.extend(Ext.grid.GridPanel,{
	id: 'leaveId',
	constructor: function(){
		leaveInfoStore = new Ext.data.JsonStore({
			url: 'leave-list.action',
			fields: ['empId','empName','empSex',
			{name: 'department', convert: function(v){return v.deptName}},
			{name: 'job', convert: function(v){return v.jobName}}]
		}); 
		var number = new Ext.grid.RowNumberer();
		LeaveGridPanel.superclass.constructor.call(this,{
			height: 320,
			viewConfig: {
				forceFit: true
			},
			columns: [
						number,sm,
						{
							header: '学生号',
							dataIndex: 'leaveAccount',
							align: 'center'
						},{
							header: '请假原因',
							dataIndex: 'leaveReason',
							align: 'center'
						},{
							header: '请假日期',
							dataIndex: 'leaveTime',
							align: 'center'
						},{
							header: '审核状态',
							dataIndex: 'approveStatus',
							align: 'center'
						},{
							header: '审核内容',
							dataIndex: 'approveContent',
							align: 'center'
						},{
							header: '审核时间',
							dataIndex: 'approveTime',
							align: 'center'
						},{
							header: '审核人',
							dataIndex: 'approveUser',
							align: 'center',
						}],
			store: leaveInfoStore,
			//添加遮罩
			loadMask: {msg: '数据正在加载中,请稍后!'},
			
			tbar: new Ext.Toolbar({
			bodyStyle: 'padding-left: 5px;',
			//depart.js中定义了depart
			items: ['部门:',new depart("员工"),'&nbsp;条目:',{
				xtype: 'combo',
				mode: 'local',//加载本地数据，必须加入
				store: new Ext.data.SimpleStore({
					fields: ['name','value'],
					data: [["",""],['empId','工号'],['empName','姓名']]
				}),
				displayField: 'value',
				valueField: 'name',
				id: 'condition',
				width: 50,
				autoLoad: true,
				listWidth: 50,
				editable: false,
				/*默认值 为query,当输入框有值时下拉列表将根据该值只显示过滤后的列表数据，可设置为all，不执行过滤*/
				triggerAction: 'all'
			},'&nbsp;内容:',{
				xtype: 'textfield',
				id: 'conditionValue',
				width: 80
			},{
				text: '&nbsp;&nbsp;查询',
				iconCls: 'search',
				handler: this.viewJob
			}]
		  }),
		  	bbar: new PagingToolbar(leaveInfoStore, 10)
		});
		
		leaveInfoStore.load({
			params: {deptId: ""}
		}); 
	}
});




